package remato.domain.common.impl;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import remato.common.domain.helpers.Nameable;
import remato.common.domain.impl.base.DomainName;
import remato.domain.common.PropertyDef;
import remato.domain.common.PropertySet;

public class PropertySetImpl extends DomainName implements PropertySet, Nameable {
	private Date updatedDate;
	private List<PropertyDef> propertyDefs;
	
	
	public PropertySetImpl() {
		super();
		propertyDefs = new ArrayList<PropertyDef>();
	}

	public Date getUpdatedDate() {
		return updatedDate;
	}

	public void setUpdatedDate(Date updatedDate) {
		this.updatedDate = updatedDate;
	}

	public boolean addPropertyDef(PropertyDef propertyDef) {
		boolean wasAdded = false;
		if (! propertyDefs.contains(propertyDef)){
			wasAdded = propertyDefs.add(propertyDef);
		}
		return wasAdded;
	}

	/**
	 * @see remato.domain.common.PropertySet#getPropertyDefs()
	 */
	public List<PropertyDef> getPropertyDefs() {
		return new ArrayList<PropertyDef>(propertyDefs);
	}
	
	public void setPropertyDefs(List<PropertyDef> propertyDefs) {
		this.propertyDefs = propertyDefs;
	}

	public boolean removePropertyDef(PropertyDef propertyDef) {
		return propertyDefs.remove(propertyDef);
	}

	
}
